#include<stdio.h>
#include<math.h>
int main()
{
	int h,m,temp;
	double d1,d2,dg;
	scanf("%d:%d",&h,&m);
	h%=12;
	d1=h/12.0*360+m/60.0*30;
	d2=m/60.0*360;
	dg=fabs(d1-d2);
	if(dg>180)
		dg=360-dg;
	if((int)(dg*100)%100<5)
		printf("%.0lf\n",dg);
	else
		printf("%.1lf\n",dg);
	return 0;
}
